package com.example.water_quality_analysis.pojo.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.IndexPrefixes;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(indexName = "water_quality_data",createIndex = false)
public class DataDoc implements Serializable {
    @Id
    @Field("id")
    private Long id;
    @Field("device_id")
    private Long deviceId;
    @Field("level_id")
    private Long levelId;
    @Field("generate_time")
    private LocalDateTime generateTime;
    @Field("ph")
    private Double ph;
    @Field("nh")
    private Double nh;
    @Field("tp")
    private Double tp;
    @Field("tn")
    private Double tn;
    @Field("temp")
    private Double temp;
    @Field("DO")
    private Double DO;
    @Field("pp")
    private Double pp;
    @Field("tds")
    private Double tds;
    @Field("ftu")
    private Double ftu;

    public DataDoc(com.example.water_quality_analysis.pojo.model.Data data) {
        this.id = data.getId();
        this.deviceId = data.getDeviceId();
        this.levelId = data.getLevelId();
        this.generateTime = data.getGenerateTime();
        this.ph = data.getPh();
        this.nh = data.getNh();
        this.tp = data.getTp();
        this.tn = data.getTn();
        this.temp = data.getTemp();
        this.DO = data.getDO();
        this.pp = data.getPp();
        this.tds = data.getTds();
        this.ftu = data.getFtu();
    }
}
